/*
 * @Author: ChaiHongJun
 * @Date: 2021-07-10 09:03:17
 * @LastEditors: ChaiHongJun
 * @LastEditTime: 2021-07-10 11:48:55
 * @version:
 * @Description:
 */
import { setItem, getItem } from "@/utils/storage";
import { SET_USER } from "../mutations-types";
export default {
  namespaced: true,
  state: {
    token: getItem("USER_TOKEN"),
    refresh_token: getItem("USER_REFRESH_TOKEN"),
  },
  mutations: {
    [SET_USER](state, payload) {
      state.token = payload.token;
      state.refresh_token = payload.refresh_token;
      //存入本地 localStorage
      setItem("USER_TOKEN", payload.token);
      setItem("USER_REFRESH_TOKEN", payload.refresh_token);
    },
  },
  actions: {},
};
